<template>
  <div class="reports-container">
    <el-card>
      <template #header>
        <div class="card-header">
          <span>常用报表</span>
        </div>
      </template>

      <!-- 卖场模块 -->
      <div class="module-section">
        <div class="module-header">
          <el-icon class="module-icon"><ShoppingCart /></el-icon>
          <span class="module-title">卖场</span>
        </div>
        <div class="reports-grid">
          <div 
            v-for="report in marketReports" 
            :key="report.path"
            class="report-item"
            @click="navigateToReport(report.path)"
          >
            <el-icon :size="32" class="report-icon">
              <component :is="report.icon" />
            </el-icon>
            <span class="report-name">{{ report.name }}</span>
          </div>
        </div>
      </div>

      <!-- 财务模块 -->
      <div class="module-section">
        <div class="module-header">
          <el-icon class="module-icon"><Money /></el-icon>
          <span class="module-title">财务</span>
        </div>
        <div class="reports-grid">
          <div 
            v-for="report in financeReports" 
            :key="report.path"
            class="report-item"
            @click="navigateToReport(report.path)"
          >
            <el-icon :size="32" class="report-icon">
              <component :is="report.icon" />
            </el-icon>
            <span class="report-name">{{ report.name }}</span>
          </div>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { DataAnalysis, Document, Coin, ShoppingCart, Money } from '@element-plus/icons-vue'

const router = useRouter()

interface ReportItem {
  name: string
  path: string
  icon: any
}

// 卖场模块报表
const marketReports: ReportItem[] = [
  {
    name: '客单分析',
    path: '/report/customer-analysis',
    icon: DataAnalysis
  }
]

// 财务模块报表
const financeReports: ReportItem[] = [
  {
    name: '供应商档案',
    path: '/report/supplier-profile',
    icon: Document
  },
  {
    name: '合同费用明细',
    path: '/report/contract-expense',
    icon: Coin
  }
]

const navigateToReport = (path: string) => {
  router.push(path)
}
</script>

<style scoped>
.reports-container {
  width: 100%;
  padding: 20px;
}

.card-header {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.module-section {
  margin-bottom: 32px;
}

.module-section:last-child {
  margin-bottom: 0;
}

.module-header {
  display: flex;
  align-items: center;
  padding: 16px 0;
  border-bottom: 2px solid #e4e7ed;
  margin-bottom: 20px;
}

.module-icon {
  font-size: 24px;
  color: #409eff;
  margin-right: 12px;
}

.module-title {
  font-size: 16px;
  font-weight: 600;
  color: #303133;
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.report-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background-color: #fff;
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.report-item:hover {
  background-color: #ecf5ff;
  border-color: #409eff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.15);
}

.report-icon {
  color: #409eff;
  margin-bottom: 12px;
}

.report-item:hover .report-icon {
  transform: scale(1.1);
  transition: transform 0.3s ease;
}

.report-name {
  font-size: 14px;
  font-weight: 500;
  color: #303133;
  text-align: center;
}

.report-item:hover .report-name {
  color: #409eff;
}
</style>



